package com.xfcy.blog.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xfcy.blog.common.R;
import com.xfcy.blog.mapper.ExceptionLogMapper;
import com.xfcy.blog.entity.ExceptionLog;
import com.xfcy.blog.service.ExceptionLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * (ExceptionLog)表服务实现类
 *
 * @author 晓风残月Lx
 * @since 2023-04-09 11:03:05
 */
@Service("exceptionLogService")
public class ExceptionLogServiceImpl extends ServiceImpl<ExceptionLogMapper, ExceptionLog> implements ExceptionLogService {

    /**
     * 异常列表
     *
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Override
    public R listException(Integer pageNo, Integer pageSize) {
        Page<ExceptionLog> exceptionLogPage = baseMapper.selectPage(new Page<>(pageNo, pageSize), null);
        return R.success(exceptionLogPage);
    }

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public R deleteBatch(List<Long> ids) {
        baseMapper.deleteBatchIds(ids);
        return R.success();
    }
}


